﻿using System;
using System.Web;
using System.Web.UI;

namespace ASPNETVN.PORTAL.Masters.ACTP
{
    public partial class ACTPLayout : MasterPage
    {
        protected override void OnInit(EventArgs e)
        {
            // Obtain Portal from Current Context
            Components.Configuration.Items.Portal portal = (Components.Configuration.Items.Portal)HttpContext.Current.Items["Portal"];

            // Title of web site.
            this.Head.Title = portal.Title;


            //leftColumn.Visible = portal.ActiveTab.ShowLeftPane;
            //rightColumn.Visible = portal.ActiveTab.ShowRightPane;

            if ((portal.ActiveTab.ShowLeftPane == false && portal.ActiveTab.ShowRightPane == false) || (!string.IsNullOrEmpty(Request.QueryString["aecid"])) || (!string.IsNullOrEmpty(Request.QueryString["amcid"])))
            {
                leftColumn.Attributes.Add("class", "");
                leftColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/0.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));

                rightColumn.Attributes.Add("class", "");
                rightColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/1.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));
            }
            else
            {
                if (portal.ActiveTab.ShowLeftPane)
                {
                    leftColumn.Attributes.Add("class", "LeftPane");
                    leftColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/left.jpg' />", Global.GetApplicationPath(), Global.GetThemeName())));
                }
                else
                {
                    leftColumn.Attributes.Add("class", "");
                    leftColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/0.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));
                }

                if (portal.ActiveTab.ShowRightPane)
                {
                    rightColumn.Attributes.Add("class", "RightPane");
                    rightColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/right.jpg' />", Global.GetApplicationPath(), Global.GetThemeName())));
                }
                else
                {
                    rightColumn.Attributes.Add("class", "");
                    rightColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/1.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));
                }
                if (Request.QueryString["cid"] != null)
                {

                    leftColumn.Attributes.Add("class", "");
                    leftColumn.Controls.Clear();
                    rightColumn.Attributes.Add("class", "");
                    rightColumn.Controls.Clear();
                    leftColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/0.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));
                    rightColumn.Controls.Add(new LiteralControl(string.Format("<img alt='' src='{0}/Masters/ASPNETVN.PORTAL.Masters.ACTP/Images/{1}/1.gif' />", Global.GetApplicationPath(), Global.GetThemeName())));
                
                }
            }

            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
